package cn.cvs.service.supplier.impl;

import cn.cvs.dao.supplier.SupplierMapper;
import cn.cvs.pojo.Supplier;
import cn.cvs.service.supplier.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service("supplierService")
public class SupplierServiceImpl implements SupplierService {
    @Autowired
    private SupplierMapper supplierMapper;
    @Override
    public List<Supplier> getList(String supName) {
        return supplierMapper.selectSupplierList(supName);
    }

    @Override
    public boolean add(Supplier supplier) {
        boolean result = supplierMapper.add(supplier) > 0 ? true : false;
        return result;
    }

    @Override
    public boolean update(Supplier supplier) {
        boolean result = supplierMapper.update(supplier) > 0 ? true : false;
        return result;
    }

    @Override
    public boolean delete(int id) {
        boolean result = supplierMapper.delete(id) > 0 ? true : false;
        return result;
    }

    public SupplierMapper getSupplierMapper() {
        return supplierMapper;
    }

    public void setSupplierMapper(SupplierMapper supplierMapper) {
        this.supplierMapper = supplierMapper;
    }
}
